package cn.kimming.common.util;

import lombok.Getter;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @author 刘铭轩
 * date 2021-03-29
 *
 * Controller异步返回结果封装类
 */

@Getter
public class Result implements Serializable {
    private boolean flag;
    private String msg;
    private Map<String, Object> data;

    public Result(boolean flag, String msg) {
        this.flag = flag;
        this.msg = msg;
    }

    public Result addData(String key, Object value) {
        if (data == null) data = new HashMap<String, Object>();
        data.put(key, value);
        return this;
    }
}
